<?php

namespace app\model;

class QuestionClass extends Common
{
    protected static $obj;

    public function _initialize()
    {
        parent::_initialize();
        $this->db_name = 'question_class';
    }

    /**
     * 类入口
     * @return QuestionClass
     */
    public static function getInstance()
    {
        if (is_null(self::$obj))
            self::$obj = new self();
        return self::$obj;
    }

    /**
     * 验证id
     * @param int $int_class_id 分类编号
     * @param string $str_module_name 模块名称
     * @return bool
     */
    public function checkId($int_class_id, $str_module_name = '')
    {
        if ($str_module_name != '') {
            $arr_where = [
                'id' => $int_class_id,
                'client' => $str_module_name
            ];
        } else {
            $arr_where = [
                'id' => $int_class_id
            ];
        }
        $int_id = intval($this->toValue($arr_where, 'id'));
        if ($int_id > 0) return true;
        return false;
    }
}
